import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    username: '',
    tpath:'1',
    ttpath:'2'
  },
  //计算属性
  getters: {
    username:(state)=>localStorage.getItem('username')
  },
  //定义修改数据的方法
  mutations: {
    setUsername:(state,username)=>{
      state.username = username
      localStorage.setItem('username',username)
    }
  },
  actions: {
  },
  modules: {
  }
})
